#pragma once

#include "Action.h"

class CRegAction : public CAction
{
public:
    CRegAction();
    ~CRegAction();

    enum Option : int {
        None = 0,
        Delete = 1,
        Write = 2,
    };

    virtual void SetAttribute(LPCTSTR strKey, LPCTSTR strValue);
    void SetParent(CAction* pParent);
    CRegAction* GetParent();
protected:
    virtual bool doit();

    HKEY GetRootKey();
    HKEY GetSubKey();
    std::wstring GetSubPath();

    bool RegDelete();
    bool RegWrite();

    LONG RecursiveDeleteKey(HKEY hKeyRoot, LPCWSTR lpSubKey);
private:
    HKEY m_hRootKey;
    HKEY m_hSubKey;
    std::wstring m_strSubPath;
    std::wstring m_strValueName;
    std::wstring m_strValueData;
    DWORD m_dwValueType;
    DWORD m_dwAccess;
    CRegAction::Option m_emOption;
};